export default {
  setLoading (state, data) {
    if (data) {
      state.loading = true
    } else {
      state.loading = false
    }
  },
  setMenuStatus (state, data) {
    if (data) {
      state.constant = true
    } else {
      state.constant = false
    }
  },
  setHeaderTit (state, data) {
    if (data) {
      state.headerTitle = data
    } else {
      state.headerTitle = ''
    }
  },
  setCategoryList (state, data) {
    let storage = window.localStorage
    if (data) {
      state.categoryList = data
      storage.setItem('categoryList', JSON.stringify(data))
    } else {
      state.categoryList = []
      storage.removeItem('categoryList')
    }
  },
  setGoodsParams (state, data) {
    let storage = window.localStorage
    if (data) {
      state.goodsParams = data
      storage.setItem('goodsParams', JSON.stringify(data))
    } else {
      state.goodsParams = {}
      storage.removeItem('goodsParams')
    }
  }
}
